package com.apts.model;

import java.util.Map;
import com.apts.jfinalbase.BaseModel;

public class TbAdmin extends BaseModel<TbAdmin> {

	private static final long serialVersionUID = -5310102820916603178L;

	public static final TbAdmin dao = new TbAdmin();

	// 管理员信息查询（根据id）
	public TbAdmin findByAccount(String account) {
		String sql = "select * from tb_admin where account = ?";
		TbAdmin admin = TbAdmin.dao.findFirst(sql, account);
		return admin;
	}

	// 管理员注册
	public void register(Map<String, Object> map) {

		String account = (String) map.get("account");
		String password = (String) map.get("password");
		String pwdsalt = (String) map.get("pwdsalt");
		String email = (String) map.get("email");
		String telephone = (String) map.get("telephone");

		TbAdmin admin = new TbAdmin();
		admin.set("account", account).set("password", password).set("pwdsalt", pwdsalt).set("email", email)
				.set("telephone", telephone).save();
	}

}
